package metier;

/**
 * @author Bruno.Bogaert@univ-lille1.fr
 *
 */
public enum FrameType
{
	AENC("Audio encryption"),
	APIC("Attached picture"),
	ASPI("Audio seek point index",4,0),
	COMM("Comments"),
	COMR("Commercial frame"),
	ENCR("Encryption method registration"),
	EQU2("Equalisation (2)",4,0),
	ETCO("Event timing codes"),
	GEOB("General encapsulated object"),
	GRID("Group identification registration"),
	LINK("Linked information"),
	MCDI("Music CD identifier"),
	MLLT("MPEG location lookup table"),
	OWNE("Ownership frame"),
	PRIV("Private frame"),
	PCNT("Play counter"),
	POPM("Popularimeter"),
	POSS("Position synchronisation frame"),
	RBUF("Recommended buffer size"),
	RVA2("Relative volume adjustment (2)",4,0),
	RVRB("Reverb"),
	SEEK("Seek frame",4,0),
	SIGN("Signature frame",4,0),
	SYLT("Synchronised lyric/text"),
	SYTC("Synchronised tempo codes"),
	TALB("Album/Movie/Show title"),
	TBPM("BPM (beats per minute)"),
	TCOM("Composer"),
	TCON("Content type"),
	TCOP("Copyright message"),
	TDEN("Encoding time",4,0),
	TDLY("Playlist delay"),
	TDOR("Original release time",4,0),
	TDRC("Recording time",4,0),
	TDRL("Release time",4,0),
	TDTG("Tagging time",4,0),
	TENC("Encoded by"),
	TEXT("Lyricist/Text writer"),
	TFLT("File type"),
	TIPL("Involved people list",4,0),
	TIT1("Content group description"),
	TIT2("Title/songname/content description"),
	TIT3("Subtitle/Description refinement"),
	TKEY("Initial key"),
	TLAN("Language(s)"),
	TLEN("Length"),
	TMCL("Musician credits list",4,0),
	TMED("Media type"),
	TMOO("Mood",4,0),
	TOAL("Original album/movie/show title"),
	TOFN("Original filename"),
	TOLY("Original lyricist(s)/text writer(s)"),
	TOPE("Original artist(s)/performer(s)"),
	TOWN("File owner/licensee"),
	TPE1("Lead performer(s)/Soloist(s)"),
	TPE2("Band/orchestra/accompaniment"),
	TPE3("Conductor/performer refinement"),
	TPE4("Interpreted, remixed, or otherwise modified by"),
	TPOS("Part of a set"),
	TPRO("Produced notice",4,0),
	TPUB("Publisher"),
	TRCK("Track number/Position in set"),
	TRSN("Internet radio station name"),
	TRSO("Internet radio station owner"),
	TSOA("Album sort order",4,0),
	TSOP("Performer sort order",4,0),
	TSOT("Title sort order",4,0),
	TSRC("ISRC (international standard recording code)"),
	TSSE("Software/Hardware and settings used for encoding"),
	TSST("Set subtitle",4,0),
	TXXX("User defined text information frame"),
	UFID("Unique file identifier"),
	USER("Terms of use"),
	USLT("Unsynchronised lyric/text transcription"),
	WCOM("Commercial information"),
	WCOP("Copyright/Legal information"),
	WOAF("Official audio file webpage"),
	WOAR("Official artist/performer webpage"),
	WOAS("Official audio source webpage"),
	WORS("Official Internet radio station homepage"),
	WPAY("Payment"),
	WPUB("Publishers official webpage"),
	WXXX("User defined URL link frame"),
	/* Obsolete frames for version >= 4.0 */
	  EQUA("Equalization",0,3),
	  IPLS("Involved people list",0,3),
	  RVAD("Relative volume adjustment",0,3),
	  TDAT("Date",0,3),
	  TIME("Time",0,3),
	  TORY("Original release year",0,3),
	  TRDA("Recording dates",0,3),
	  TSIZ("Size",0,3),
	  TYER("Year",0,3);

	public final String description;
	public final int minVersion;
	public final int maxVersion;
	private FrameType(String description, int minVersion, int maxVersion)
	{
		this.description=description;
		this.minVersion = minVersion;
		this.maxVersion = maxVersion;
	}

	private FrameType(String description)
	{
		this(description,2,0);
	}

	public boolean isText()
	{
		return this.name().charAt(0)=='T';
	}
	public boolean isURL()
	{
		return this.name().charAt(0)=='W';
	}
	public boolean allowedInVersion(int version)
	{
		return version >= minVersion && ( maxVersion==0 || version <= maxVersion); 
	}

}